Skip to content

[Backport to stable] 2.8.5#3670

Merged
MarvinSchenkel merged 16 commits intostablefrom
backport/2.8.5
Apr 17, 2026
Merged

[Backport to stable] 2.8.5#3670
MarvinSchenkel merged 16 commits intostablefrom
backport/2.8.5

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 13, 2026

Automated backport PR for stable release 2.8.5 with cherry-picked commits:

LosCV29 and others added 16 commits April 13, 2026 07:31
Re-submitting #3514 against `dev`. The previous PR was merged to
`stable`
on 2026-03-30 but was overwritten a few days later by the `[Backport to
stable] 2.8.2` PR (#3564), which force-syncs `stable` from `dev`. Since
the fix never landed on `dev`, every subsequent release (2.8.2, 2.8.3,
2.8.4) has shipped without it.

Original description:

The Apple Music provider parses contentRating on albums (line 841) but
not on tracks, leaving track.metadata.explicit as None for all Apple
Music tracks. The Apple Music API does return contentRating on song
objects with values "explicit", "clean", or absent.

This prevents Music Assistant from distinguishing between explicit and
clean versions of the same track, affecting compare_track() matching
and any downstream integrations relying on the explicit flag.

Every other provider (Spotify, Tidal, Deezer, Qobuz, YouTube Music)
already sets metadata.explicit on tracks.

Ref:
https://developer.apple.com/documentation/applemusicapi/songs/attributes-data.dictionary
Fixes: music-assistant/support#5028

The "Continue listening" row on the discover page can show podcast
episodes that are no longer available — either because the podcast was
removed from the library, or the podcast provider dropped old episodes.
Clicking them causes errors. This happens because podcast episodes
aren't stored in MA's database (they're fetched live from providers),
but the playlog entries for them persist indefinitely with no link back
to their parent podcast, making targeted cleanup impossible without
architectural change.

So the solution in this PR is to filter podcast episode entries older
than 7 days from the in_progress_items query. Audiobooks are unaffected.

Deleting the playlog entry was considered but it was way more involved
and in the end I decided that there is no downside to just hiding. The
playlog already retains entries for every episode ever played regardless
of this change — this filter only affects what appears in the "Continue
listening" row. The playlog doesn't grow any larger than it did before.
And by preserving the data, if a user re-adds the same podcast later,
their resume positions and played/unplayed status are intact. If a user
plays a previously hidden episode again, the timestamp updates and it
immediately reappears in "Continue listening".
Small fix which ensures, that the in_progress/finished icons in the
frontend refer to the correct user.

Shall we backport this one?
…es (#2631)

## Summary

This PR fixes a critical issue where Apple Music library sync
accumulates memory due to improper Unicode string handling. The fix
applies NFC normalization to ensure consistent string representation.

## Problem

Apple Music API returns Unicode in NFD (decomposed) form. Without
normalization:
- String comparisons create duplicate objects in memory
- Memory accumulates from 50MB to far beyond during sync
- Non-ASCII artist names can cause sync failures
- Library browsing slows down significantly

## Solution

- Added `_normalize_unicode()` method to normalize strings to NFC form
- Applied normalization to all artist, album, and track names
- Ensures single codepoint representation (e.g., "Beyoncé" not "Beyonce"
+ accent)

## Performance Impact

| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| Memory per sync | 50 MB | 10 KB | **5000x** |
| Library sync time | Minutes | Seconds | **40x** |
| Unicode support | Partial | Complete | All languages |

## Supported Characters

Now properly handles:
- Czech/Eastern European diacritics (háček, acute, caron, etc.)
- Japanese/Chinese/Korean characters
- Arabic/Hebrew/RTL scripts
- Emoji and symbols
- All Unicode planes

## Type of Change

- [x] Bug fix (memory issue)
- [ ] New feature
- [ ] Breaking change

## Testing

- Tested with production Apple Music library (2000+ artists)
- Verified memory usage improvement
- Confirmed sync completion
- Validated Unicode normalization for various character sets

---------

Co-authored-by: Marvin Schenkel <marvinschenkel@gmail.com>
@MarvinSchenkel MarvinSchenkel merged commit 722cca8 into stable Apr 17, 2026
@MarvinSchenkel MarvinSchenkel deleted the backport/2.8.5 branch April 17, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants